package com.itheima.mapper;

import com.itheima.pojo.User;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface UserMapper {

    @Select("select * from tb_user")
    List<User> findAll();


    @Select("select * from tb_user where id = #{id}")
    User findById(int id);

    @Delete("delete from tb_user where id=#{id}")
    void deleteById(int id);

    @Update("update tb_user set username = username,password = password where id = #{id};")
    void update(User user);

    @Insert("insert into tb_user values(#{id},#{username},#{password})")
    void add(User user);

}
